// 角色管理
import request from '@/utils/request'

// 获取角色管理列表
export const getRolePage = (data) => {
  return request({ url: `/xddcloud-psc/psc/role/page`, method: 'POST', data })
}

// 新增角色
export const addRole = (data) => {
  return request({ url: `/xddcloud-psc/psc/role/add`, method: 'POST', data })
}

// 修改角色
export const editRole = (data) => {
  return request({ url: `/xddcloud-psc/psc/role/edit`, method: 'PUT', data })
}

// 删除角色
export const deleteRole = (params) => {
  return request({ url: `/xddcloud-psc/psc/role/logicDeleteByRole`, method: 'PUT', params })
}

// 给角色分配权限
export const assignRoleMenu = (roleId, data) => {
  return request({ url: `/xddcloud-psc/psc/role/assignMenu/${roleId}`, method: 'PUT', data })
}

// 获取角色详情
export const getRoleDetail = (params) => {
  return request({ url: `/xddcloud-psc/psc/role/get/${params.id}`, method: 'GET' })
}
// 同步权限
export const getSyncPoint= () => {
  return request({ url: `/xddcloud-psc/psc/permission/sync/execute`, method: 'GET' })
}
// 权限表单
export const getSyncPointList= () => {
  return request({ url: `/xddcloud-psc/psc/permission/point/list`, method: 'GET' })
}
// 权限保存
export const addRolePonint = (roleId,data) => {
  return request({ url: `/xddcloud-psc/psc/role/permission/add/${roleId}`, method: 'POST' ,data})
}
//获取角色下的权限点
export const getRolePonint = (roleId) => {
  return request({ url: `/xddcloud-psc//psc/role/permission/${roleId}`, method: 'get'})
}
